/**
 * 
 */
package grimbo.goodwinfooty.service.model;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class Game implements Serializable {
	private static final long serialVersionUID = 1437404045507680788L;
	private int id;
	private Date date;
	private List payments = new ArrayList();
	private int price;

	public void addPayment(PlayerPayment pp) {
		payments.add(pp);
	}

	public Date getDate() {
		return date;
	}

	public PlayerPayment getPayment(int i) {
		return (PlayerPayment) payments.get(i);
	}

	public List getPayments() {
		return payments;
	}

	public int getPrice() {
		return price;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public void setPayments(List payments) {
		this.payments = payments;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public String toString() {
		String sDate = null;
		if (null != date) {
			SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy");
			sDate = sdf.format(date);
		}
		return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
				.append("id", id).append("date", sDate).append("price", price)
				.append("payments", payments).toString();
	}
}